// https://leetcode.cn/problems/maximum-length-of-pair-chain/
// 2022-9-3

#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>


using namespace std;
class Solution {
public:
    int findLongestChain(vector<vector<int>>& pairs) {
		sort(pairs.begin(), pairs.end());
		
		int maxN = 1;
		int prev = nums[nums.size() - 1][0];
		for(int i = nums.size() - 2; i >= 0; i--){
			if(nums[i][1] < prev){
				maxN++;
				prev = nums[i][0];
			}
		}
		
		return maxN;
    }
};

int main(){
	Solution so;
	vector<vector<int>> pairs  = {{1,7},{4,5},{4,6},{5,6},{2,3},{1,2},{3,4}};
	cout << so.findLongestChain(pairs);
	return 0;
}